package com.wangsd.web.coupon.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wangsd.web.coupon.entity.Member;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wangsd.web.coupon.entity.Merchant;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author generator
 * @since 2019-09-25
 */
public interface MemberMapper extends BaseMapper<Member> {

    @Update("update member set integral = integral + 1 where mini_openid=#{openid}")
    int updateIntegralByOpenid(@Param("openid") String openid);

    @Update("update member set integral = integral - 2 where mini_openid=#{openid}")
    void updateReduceIntegralByOpenid(@Param("openid") String openid);

    @Update("update member set integral = integral + #{integral}  where mini_openid=#{openid}")
    int updateIntegral(@Param("openid") String openid, @Param("integral") Integer integral);

    @Update("update member set integral = #{value} where company_id = #{companyId}")
    int dealZeroPointsByCompanyId(@Param("companyId") Long companyId, @Param("value") Object value);

    IPage<Member> selectListXml(Page<Member> page, @Param("member") Member member, @Param("code") String code);
}
